<template>
  <div>
    <div class="PersonTop">
      <div class="PersonTop_img">
        <img src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" />
      </div>
      <div class="PersonTop_text">
        <div class="user_text">
          <div class="user_name">
            <span> et </span>
          </div>
          <!-- <div class="user-v">
            <img src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" class="user-v-img" />
            <span class="user-v-font">优质媒体作者</span>
          </div> -->
          <div class="user_qianming">
            <span> good</span>
          </div>
          <div class="user_anniu">
            <el-button class="el-icon-edit" type="primary" size="medium" plain @click="open">编辑</el-button>
          </div>
        </div>
        <div class="user_num">
          <div style="cursor: pointer">
            <span class="num_text">粉丝</span>
          </div>
          <div style="cursor: pointer">
            <span class="num_text">关注</span>
          </div>
          <div>
            <span class="num_text">获赞</span>
          </div>
        </div>
      </div>
    </div>
    <div class="person_body">
      <div class="person_body_left">
        <el-card class="box-card" :body-style="{ padding: '0px' }">
          <div slot="header" class="clearfix">
            <span class="person_body_list" style="border-bottom: none">个人中心</span>
          </div>
          <el-menu class="el-menu-vertical-demo" @select="handleMenuSelect">
            <el-menu-item index="1">
              <i class="el-icon-edit-outline"></i>
              <span slot="title">简介</span>
            </el-menu-item>
            <el-menu-item index="2">
              <i class="el-icon-edit-outline"></i>
              <span slot="title">发帖</span>
            </el-menu-item>
            <el-menu-item index="3">
              <i class="el-icon-document"></i>
              <span slot="title">收藏</span>
            </el-menu-item>
            <el-menu-item index="4">
              <i class="el-icon-tableware"></i>
              <span slot="title">粉丝</span>
            </el-menu-item>
            <el-menu-item index="5">
              <i class="el-icon-circle-plus-outline"></i>
              <span slot="title">关注</span>
            </el-menu-item>
          </el-menu>
        </el-card>
      </div>
      <div class="person_body_right">
        <router-view></router-view>
      </div>
    </div>
    <UserInformationDialog ref="userInformationDialog" @close-dialog="close"></UserInformationDialog>
  </div>
</template>
  
<script>
import UserInformationDialog from "@/views/userInformationDialog.vue";

export default {
  mounted() {
    if (this.$route.path === '/userCenter') {
      this.$router.push("/userProfile");
    }
  },
  components: {
    UserInformationDialog,
  },
  data() {
    return {
      dialogVisible: false,
    };
  },
  methods: {
    open() {
      console.log("dia open");
      this.$refs.userInformationDialog.open();
    },
    close() {
      this.dialogVisible = false;
    },
    handleMenuSelect(index) {
      switch (index) {
        case "1":
          if (this.$route.path !== "/userProfile") {
            this.$router.push("/userProfile");
          }
          break;
        case "2":
          if (this.$route.path !== "/userChildren") {
            this.$router.push("/userChildren");
          }
          break;
        case "3":
          if (this.$route.path !== "/userChildren") {
            this.$router.push("/userChildren");
          }
          break;
        case "4":
          if (this.$route.path !== "/userChildren") {
            this.$router.push("/userChildren");
          }
          break;
        case "5":
          if (this.$route.path !== "/userChildren") {
            this.$router.push("/userChildren");
          }
          break;
        default:
          break;
      }
    }
  },
};
</script>
  
<style scoped>
  .scrollable-content {
    height: 100%;
    overflow-y: auto;
  }
  
  .PersonTop {
    width: 1000px;
    height: 140px;
    padding-top: 20px;
    background-color: white;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    border-radius: 5px;
  }
  
  .PersonTop_img {
    width: 150px;
    height: 120px;
    background-color: #8c939d;
    margin-right: 24px;
    margin-left: 20px;
    overflow: hidden;
    border-radius: 20px;
  }
  
  .PersonTop_img img {
    width: 100%;
    height: 100%;
    border-radius: 20px;
  }
  
  .PersonTop_text {
    height: 120px;
    width: 880px;
    display: flex;
  }
  
  .user_text {
    width: 60%;
    height: 100%;
    line-height: 30px;
  }
  
  .user_name {
    font-weight: bold;
  }

  .user_qianming {
    font-size: 14px;
    color: #999;
  }
  
  .user_num {
    width: 40%;
    height: 100%;
    display: flex;
    align-items: center;
  }
  
  .user_num > div {
    text-align: center;
    border-right: 1px dotted #999;
    box-sizing: border-box;
    width: 80px;
    height: 40px;
    line-height: 20px;
  }

  .el-icon-edit{
    width: 20%;
  }
  
  .num_text {
    color: #999;
  }
  
  .num_number {
    font-size: 20px;
    color: #333;
  }
  
  .person_body {
    width: 1000px;
    height: calc(100% - 210px);
    margin-top: 20px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    border-radius: 5px;
  }
  
  .person_body_left {
    width: 27%;
    height: 430px;
    border-radius: 5px;
    margin-right: 3%;
    text-align: center;
  }
  
  .person_body_right {
    width: 70%;
    height: 430px;
    border-radius: 5px;
    background-color: white;
    overflow-y: auto;
  }
  
  .box-card {
    height: 100%;
  }
  
</style>
  
  